package com.xiaoyi.controller;

import com.xiaoyi.service.SysRegionService;
import com.xiaoyi.service.impl.SysRegionServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(urlPatterns = "/sysRegion.do")
public class SysRegionController extends HttpServlet {
    //引入三级联动 service
    private SysRegionService service=new SysRegionServiceImpl();
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //业务层处理完成之后 响应给前端的JSON的字符串
        String respStrForJSON=service.queryAddress(req);
        //修改响应的格式
        resp.setHeader("Content-Type","text/html;charset=utf-8");
        //把service返回的JSON字符串通过response写出
        resp.getWriter().write(respStrForJSON);
    }
}
